package cn.ht.jywrwater.module.ht.dal.mysql.customermeter;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.customermeter.CustomerMeterDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.customermeter.vo.*;

/**
 * 水表用户绑定关系 Mapper
 *
 * @author hzx
 */
@Mapper
public interface CustomerMeterMapper extends BaseMapperX<CustomerMeterDO> {

    default PageResult<CustomerMeterDO> selectPage(CustomerMeterPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerMeterDO>()
                .eqIfPresent(CustomerMeterDO::getMeterCode, reqVO.getMeterCode())
                .eqIfPresent(CustomerMeterDO::getCustomerCode, reqVO.getCustomerCode())
                .orderByDesc(CustomerMeterDO::getId));
    }

    default List<CustomerMeterDO> selectList(CustomerMeterExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CustomerMeterDO>()
                .eqIfPresent(CustomerMeterDO::getMeterCode, reqVO.getMeterCode())
                .eqIfPresent(CustomerMeterDO::getCustomerCode, reqVO.getCustomerCode())
                .orderByDesc(CustomerMeterDO::getId));
    }

}
